home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / pgp20src.zip / CRYPTO.H < prev    next >
C/C++ Source or Header  |  1992-07-14  |  3KB  |  85 lines

  1. /* crypto.h - C headers for crypto.c 
  2. */
  3.  
  4. /* Used to determine if nesting should be allowed */
  5. boolean legal_ctb(byte ctb);
  6.  
  7. /* Write an RSA-signed message digest of input file to specified output
  8.    file, and append input file to output file */
  9. int signfile(boolean nested, boolean separate_signature, char *mcguffin,
  10.              char *infile, char *outfile, char lit_mode, char *literalfile);
  11.  
  12. /* Reads the first count bytes from infile into header */
  13. int get_header_info_from_file(char *infile, byte *header, int count);
  14.  
  15. /* RSA-encrypt a file */
  16. int encryptfile(char *mcguffin, char *infile, char *outfile, 
  17.     boolean attempt_compression);
  18.  
  19. /* Encrypt file with IPES/IDEA cipher */
  20. int idea_encryptfile(char *infile, char *outfile, 
  21.     boolean attempt_compression);
  22.  
  23. /* Prepend a CTB_LITERAL prefix to a file */
  24. int make_literal(char *infile, char *outfile, char lit_mode, char *literalfile);
  25.  
  26. /* Decrypt a file (RSA or IPES/IDEA) */
  27. int decryptfile(char *infile, char *outfile);
  28.  
  29. /* Check signature in infile for validity.  Strip off the signature and
  30.    write the remaining packet to outfile */
  31. int check_signaturefile(char *infile, char *outfile, boolean strip_signature,
  32.             boolean explicit_outfile_flag);
  33.  
  34. /* Decrypt file with IPES/IDEA only */
  35. int idea_decryptfile(char *infile, char *outfile);
  36.  
  37. /* Decompress a file with ZIP algorithm */
  38. int decompress_file(char *infile, char *outfile);
  39.  
  40. /* Strip off literal prefix from infile, copying to outfile */
  41. int strip_literal(char *infile, char *outfile, boolean explicit_outfile_flag,
  42.         char *lit_mode);
  43.  
  44. /* Write a multiprecision integer to a file */
  45. void write_mpi(unitptr n, FILE *f, boolean scrambled);
  46.  
  47. /* Read a mutiprecision integer from a file */
  48. int read_mpi(unitptr r, FILE *f, boolean adjust_precision, boolean scrambled);
  49.  
  50. /* Convert C <-> Quiche strings */
  51. void CToPascal(char *s);
  52. void PascalToC( char *s );
  53.  
  54. /* Reads IPES/IDEA random key and random number seed from file, cranks the
  55.    the seed through the idearand strong pseudorandom number generator, and
  56.    writes them back out */
  57. int strong_pseudorandom(byte *buf, int bufsize);
  58.  
  59. /*    Return date string, given pointer to 32-bit timestamp */
  60. char *cdate(word32 *tstamp);
  61.  
  62. /*    Return date and time string, given pointer to 32-bit timestamp */
  63. char *ctdate(word32 *tstamp);
  64.  
  65. /* Return current timestamp as a byte array and as a 32-bit word */
  66. word32 get_timestamp(byte *timestamp);
  67.  
  68. /*    Returns the length of a packet according to the CTB and the length field */
  69. word32 getpastlength(byte ctb, FILE *f);
  70.  
  71. /* Write a CTB with the appropriate length field */
  72. void write_ctb_len (FILE *f, byte ctb_type, word32 length, boolean big);
  73.  
  74. /* Print an error message and return nonzero if val != checkval */
  75. int version_error (int val, int checkval);
  76.  
  77. int check_key_sig(FILE *fkey, long fpkey, int keypktlen, char *keyuserid,
  78.      FILE *fsig, long fpsig, char *keyfile, char *siguserid, byte *xtimestamp,
  79.      byte *sigclass);
  80.  
  81. int squish_file(char *infile, char *outfile);
  82.  
  83. int signkey(char *keyguffin, char *sigguffin, char *keyfile);
  84.  
  85.